export default function pageAuto(width: number, height: number, elId: any) {
    if (elId) {
        elId.style.transform = `scale(${getScale(
            width,
            height
        )}) translate(-50%, -50%)`;
        elId.style.width = width + "px";
        elId.style.height = height + "px";
        elId.style.position = "fixed";
        elId.style.top = "50%";
        elId.style.left = "50%";
        elId.style.zIndex = "999";
        elId.style.display = "flex";
        elId.style.flexDirection = "column";
        elId.style.overflow = "hidden";
        elId.style.transition = "all 0.3s";
        elId.style.transformOrigin = "left top";
        window.addEventListener("resize", () => {
            elId.style.transform = `scale(${getScale(
                width,
                height
            )}) translate(-50%, -50%)`;
        });
    }
}
function getScale(width: number, height: number) {
    let ww = window.innerWidth / width;
    let wh = window.innerHeight / height;
    return ww < wh ? ww : wh;
}
